#ifndef TIMELINE_H
#define TIMELINE_H

#include <wx/wx.h>
#include <wx/dcbuffer.h>

#include "../include/Config.h"
#include "../include/AnimationManager.h"

class ProjectFrame;

class TimeLine: public wxPanel
{
    public:
        TimeLine(wxWindow* parent,
                 Config* config,
                 ProjectFrame* projectFrame,
                 AnimationManager* animMgr = NULL,
                 wxWindowID id = wxID_ANY,
                 const wxPoint& pos = wxDefaultPosition,
                 long style = wxTAB_TRAVERSAL,
                 const wxString& name = wxT("TimeLine"));
        virtual ~TimeLine();

        /** Draws the whole widget
        * @return void
        */
        void draw();

        void setAnimationManager( AnimationManager* animMgr);

        void setConfig( Config* config);

        void reset();

    private:

        AnimationManager* animMgr;

        Config* config;

        /** Keeps info if it's draggig or not */
        bool dragging;

        /** Dragged distance from the timeline's begin */
        unsigned long displacement;

        /** Number of clicked pixel on dragging start */
        int dragStart;

        /** Method connected to the EVT_PAINT
        * @param evt - wxPaintEvent holding event's detailed data
        */
        void paintEvent(wxPaintEvent & evt);

        /** Method connected to the EVT_SIZE
        * @param evt - wxSizeEvent holding event's detailed data
        */
        void resize(wxSizeEvent & evt);


        /** Method connected to the EVT_ERASE_BACKGROUND
        * @param evt - wxEraseEvent holding event's detailed data
        */
        void eraseBackground(wxEraseEvent& evt);

        /** Method connected to the EVT_MOTION
        * @param evt - wxMouseEvent holding event's detailed data
        */
        void mouseMoved(wxMouseEvent& evt);

        /** Method connected to the EVT_LEFT_DOWN
        * @param evt - wxMouseEvent holding event's detailed data
        */
        void mouseLeftDown(wxMouseEvent& evt);

        /** Method connected to the EVT_LEFT_UP
        * @param evt - wxMouseEvent holding event's detailed data
        */
        void mouseReleased(wxMouseEvent& evt);

        /** Method connected to the EVT_RIGHT_DOWN
        * @param evt - wxMouseEvent holding event's detailed data
        */
        void mouseRightDown(wxMouseEvent& evt);

        /** Method connected to the EVT_MIDDLE_DOWN
        * @param evt - wxMouseEvent holding event's detailed data
        */
        void mouseMiddleDown(wxMouseEvent& evt);

        int elemSize;

        int elemInterval;

        int tapeHeight;

        wxPoint tapeMargin;

        int tapeInnerMargin;

        wxMemoryDC* sprite;

        int hovered;

        DECLARE_EVENT_TABLE()
};

#endif // TIMELINE_H
